﻿using ReflectionStudio.Core.Events;
using System;
using System.Windows;
using System.Windows.Controls;
using Fluent;
namespace ReflectionStudio.Components.UserControls
{
	/// <summary>
	/// StatusBar is giving zoom, message, progress functionnalities
	/// </summary>
	public partial class StatusBar : UserControl
	{
         
        public Slider SliderZoom
        {
            get
            {
                return (Slider)this.FindName("sliderZoom");
            }
        }
		/// <summary>
		/// Constructor
		/// </summary>
		public StatusBar()
		{
			InitializeComponent();
		}

	 

		#region --------------------EVENT HANDLING--------------------

		/// <summary>
		/// Status handler to update the message and ProgressBar
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		public void OnStatusChange(object sender, StatusEventArgs e)
		{
			switch (e.StatusType)
			{
				case StatusEventType.StartProgress:
					this.tbMessage.Text = e.Info.Details;
					//this.progressBar.Visibility = Visibility.Visible;
					this.progressBar.IsIndeterminate = true;
					break;
                case StatusEventType.RunningProgress:
                    this.tbMessage.Text = e.Info.Details;
                    //this.progressBar.Visibility = Visibility.Visible;
                    this.progressBar.IsIndeterminate = true;
                    break;
                case StatusEventType.UserLogIn:
                    this.tbUser.Text = e.Info.Details; 
                    break;
				case StatusEventType.StopProgress:
					this.tbMessage.Text = e.Info.Details;
					//this.progressBar.Visibility = Visibility.Hidden;
					this.progressBar.IsIndeterminate = false;
					break;
			}
		}

		/// <summary>
		/// Message handler to update the statusbar
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		internal void OnMessage(object sender, MessageEventArgs e)
		{
			if (e.Info.Details != string.Empty && e.Info.Type == MessageEventType.Info)
				this.tbMessage.Text = e.Info.Details;
		}

		#endregion

	 
	}

	/// <summary>
	/// Event argument that is send with the new scale value
	/// </summary>

}
